/**
 * 
 */
package com.mrjy.weixin.bo;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import com.mrjy.common.entity.WxMsgNews;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import com.mrjy.common.entity.SchoolTeam;
import com.mrjy.common.entity.WeixinInfo;
import com.mrjy.common.entity.WeixinNews;
import com.mrjy.weixin.dao.IWeixinNewsDao;

/**
 * @author夏奕敏
 *
 * @version 创建时间：2016年5月16日 下午5:03:28
 */
@Service("weixinNewsBo")
public class WeixinNewsBo implements IWeixinNewsBo {
	@Resource
	private IWeixinNewsDao weixinNewsDao ;
	@Override
	public Map<String, Object> queryPageWeixinNews(WxMsgNews weixinNews) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("total", weixinNewsDao.countWeixinNews(weixinNews));
		map.put("rows", weixinNewsDao.queryPageWeixinNews(weixinNews));
		return map;
	}
	
	//添加图文消息
	@Override
	public int insert(WxMsgNews weixinNews) {
		// TODO Auto-generated method stub
		return weixinNewsDao.insert(weixinNews);
	}
	@Override
	public WxMsgNews queryById(int id) {
		// TODO Auto-generated method stub
		return weixinNewsDao.queryById(id);
	}
	
	@Override
	public int txUpdateById(WxMsgNews weixinNews) {
		// TODO Auto-generated method stub
		return weixinNewsDao.updateById(weixinNews);
	}
	
	@Override
	public int txDeleteByIds(int[] ids) {
		// TODO Auto-generated method stub
		try{
			return weixinNewsDao.deleteByIds(ids);
		}catch(DataAccessException  e){
			return 0;
		}
	}

}
